package com.yupi.springbootinit.exception;

import org.springframework.stereotype.Component;

import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.ThreadPoolExecutor;

@Component
public class MyRejectException extends Throwable implements RejectedExecutionHandler {
    @Override
    public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
        throw new RejectedExecutionException("拒绝原因是任务:" + r.toString() + "执行失败，执行者是:" + executor.toString());
    }
}
